package com.cq.hd.app.controller;

import com.cq.hd.app.biz.HfCallbackBiz;
import com.cq.hd.system.api.dto.HfVerifyDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/hfCallback")
public class HfCallbackController {

    @Autowired
    private HfCallbackBiz hfCallbackBiz;

    // 企业商户基本信息入驻审核消息异步回调地址
    @RequestMapping("/merchantEntAudit")
    public String merchantEntAudit(HttpServletRequest request) {
        HfVerifyDto hfVerifyDto = new HfVerifyDto(request.getParameter("data"), request.getParameter("sign"));
        return hfCallbackBiz.merchantEntAuditCallback(hfVerifyDto);
    }

    // 商户业务开通审核消息异步回调地址
    @RequestMapping("/merchantOpenAudit")
    public String merchantOpenAudit(HttpServletRequest request) {
        HfVerifyDto hfVerifyDto = new HfVerifyDto(request.getParameter("data"), request.getParameter("sign"));
        return hfCallbackBiz.merchantOpenAuditCallback(hfVerifyDto);
    }

    // 商户业务开通业务开通结果消息异步回调地址
    @RequestMapping("/merchantOpenBusiness")
    public String merchantOpenBusiness(HttpServletRequest request) {
        HfVerifyDto hfVerifyDto = new HfVerifyDto(request.getParameter("data"), request.getParameter("sign"));
        return hfCallbackBiz.merchantOpenBusinessCallback(hfVerifyDto);
    }

    // 子账户开通审核消息异步回调地址
    @RequestMapping("/merchantSettleConfigAudit")
    public String merchantSettleConfigAudit(HttpServletRequest request) {
        HfVerifyDto hfVerifyDto = new HfVerifyDto(request.getParameter("data"), request.getParameter("sign"));
        return hfCallbackBiz.merchantSettleConfigAuditCallback(hfVerifyDto);
    }

    // 微信商户配置异步回调地址
    @RequestMapping("/wxBusinessConfig")
    public String wxBusinessConfig(HttpServletRequest request) {
        HfVerifyDto hfVerifyDto = new HfVerifyDto(request.getParameter("data"), request.getParameter("sign"));
        return hfCallbackBiz.wxBusinessConfigCallback(hfVerifyDto);
    }

    // 个人商户基本信息入驻审核消息异步回调地址
    @RequestMapping("/merchantEntIndvAudit")
    public String merchantEntIndvAudit(HttpServletRequest request) {
        HfVerifyDto hfVerifyDto = new HfVerifyDto(request.getParameter("data"), request.getParameter("sign"));
        return hfCallbackBiz.merchantEntIndvAuditCallback(hfVerifyDto);
    }

    // 聚合正扫交易异步回调地址
    @RequestMapping("/jsPay")
    public String jsPay(HttpServletRequest request) {
        HfVerifyDto hfVerifyDto = new HfVerifyDto(request.getParameter("resp_data"), request.getParameter("sign"));
        return hfCallbackBiz.jsPayCallback(hfVerifyDto);
    }

    // 网银支付交易异步回调地址
    @RequestMapping("/bankPay")
    public String bankPay(HttpServletRequest request) {
        HfVerifyDto hfVerifyDto = new HfVerifyDto(request.getParameter("resp_data"), request.getParameter("sign"));
        return hfCallbackBiz.bankPayCallback(hfVerifyDto);
    }

    // 汇付插件下单
    @RequestMapping("/preOrder")
    public String preOrder(HttpServletRequest request) {
        HfVerifyDto hfVerifyDto = new HfVerifyDto(request.getParameter("resp_data"), request.getParameter("sign"));
        return hfCallbackBiz.preOrderCallback(hfVerifyDto);
    }

    // 交易退款
    @RequestMapping("/refund")
    public String refund(HttpServletRequest request) {
        HfVerifyDto hfVerifyDto = new HfVerifyDto(request.getParameter("resp_data"), request.getParameter("sign"));
        return hfCallbackBiz.refundCallback(hfVerifyDto);
    }

    // 用户业务入驻异步通知回调
    @RequestMapping("/agentUserEntAudit")
    public String agentUserEntAudit(HttpServletRequest request) {
        HfVerifyDto hfVerifyDto = new HfVerifyDto(request.getParameter("data"), request.getParameter("sign"));
        return hfCallbackBiz.agentUserEntAuditCallback(hfVerifyDto);
    }

    // 用户签约结果异步通知回调
    @RequestMapping("/agentUserSign")
    public String agentUserSign(HttpServletRequest request) {
        HfVerifyDto hfVerifyDto = new HfVerifyDto(request.getParameter("data"), request.getParameter("sign"));
        return hfCallbackBiz.agentUserSignCallback(hfVerifyDto);
    }

    // 商户基本信息修改异步回调地址
    @RequestMapping("/merchantEntUpdate")
    public String merchantEntUpdate(HttpServletRequest request) {
        HfVerifyDto hfVerifyDto = new HfVerifyDto(request.getParameter("data"), request.getParameter("sign"));
        return hfCallbackBiz.merchantEntUpdateCallback(hfVerifyDto);
    }

    // 用户业务入驻修改异步通知回调
    @RequestMapping("/agentUserEntModify")
    public String agentUserEntModify(HttpServletRequest request) {
        HfVerifyDto hfVerifyDto = new HfVerifyDto(request.getParameter("data"), request.getParameter("sign"));
        return hfCallbackBiz.agentUserEntModifyCallback(hfVerifyDto);
    }

    // 子账户修改审核消息异步回调地址
    @RequestMapping("/merchantSettleModifyAudit")
    public String merchantSettleModifyAudit(HttpServletRequest request) {
        HfVerifyDto hfVerifyDto = new HfVerifyDto(request.getParameter("data"), request.getParameter("sign"));
        return hfCallbackBiz.merchantSettleModifyAudit(hfVerifyDto);
    }


}
